Skip to content

5.4.0 → 5.7.0: Paper on Brigadier, Component messages, unregisterAll, @Default, describe() - #58

Merged
Traqueur-dev merged 4 commits into
masterfrom
ccr-55933618-ihvtq0
Oct 21, 2026
Merged

Traqueur-dev merged 4 commits into
masterfrom
ccr-55933618-ihvtq0

Conversation

@Traqueur-dev

@Traqueur-dev Traqueur-dev commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

The changes asked for by Valkn (a Paper 26.3 / Java 25 plugin stack built on CommandsAPI), delivered as four minor versions, one commit each, with a CHANGELOG.md and a README section per feature. Nothing changes for code that does not use the new APIs, except the points under Behaviour changes. The tests that existed in 5.3.1 pass unmodified.

5.4.0: no network call on startup, unregisterAll, requirement names

  • Opt-in update check: the CommandManager constructor no longer calls Updater.checkUpdates(). -Dcommands.updater=false turns even an explicit call off. Versions are compared as versions, so a local version newer than the published one (a snapshot, a build named after a commit), or a failed check, announces nothing.
  • CommandManager#unregisterAll() removes every command the manager registered, with its aliases and subcommands, and only those.
  • Requirement#name() (default: the simple class name) fills %requirement% when errorMessage() is empty. A non-empty errorMessage() is still sent as-is, so existing messages read the same.
  • Spigot fix: an unregistered command is now removed from the command map's known commands. Before, it was only marked as unregistered and kept answering.
  • Spigot and Velocity fix: unregistering a label held by another plugin no longer removes that plugin's command.

5.5.0: messages as Component

  • New adventure-addon module: ComponentMessageFormatter<S> receives the MessageKey and the values (arg, requirement, usage) separately, never substituted into the text. The component is sent as a component, so click and hover events survive.
  • ComponentMessageFormatter.miniMessage(...) reads MiniMessage templates, from a function or from a MessageHandler.
  • setComponentFormatter on the Velocity manager, and on the new Paper one in 5.6.0.
  • The core stays free of Adventure. It gains MessageKey, MessageDispatcher, CommandManager#sendMessage(receiver, key, text, values) and MessageHandler#getMessage(key). Without a dispatcher, the text path is unchanged.

5.6.0: platform-paper on Brigadier

  • Registers commands through LifecycleEvents.COMMANDS:
    • numbers, booleans and Infinite (as a greedy string) become typed Brigadier nodes;
    • String, custom converters, and numbers read by a plugin's own converter become a word, with the tab completer's suggestions.
  • The permission and the requirements become the node's requires. Running a node goes through the usual invoker.
  • BrigadierCommandTree holds the translation and can be tested with Brigadier alone.
  • paper-test-plugin for manual testing.
  • Compiled against the Paper API 1.21.4 (Java 21), so the build and CI stay on Java 21.
  • Tested on real servers, Paper 1.21.4 and Paper 26.3 on Java 25. The README documents what happens to a command added or removed after startup:
    • a new label answers only after /minecraft:reload;
    • a removed command is hidden by its requires and answers as unknown;
    • a command registered again keeps the shape its node had when the tree was built.
  • Fix to 5.5.0: miniMessage(...) left the tag of an absent value as typed (<arg> in a USAGE message); absent values are now empty.

5.7.0: @Default and describe()

  • @Default("1") makes an annotated argument optional. The value is converted by the parameter type's converter. On an Optional it is wrapped. An invalid default on a primitive is refused at registration. The Optional<T> support that already existed is now documented.
  • manager.describe() returns a public, read-only tree of CommandDescription / ArgumentDescription:
    • name, path, aliases, description, usage, permission, in-game only;
    • required and optional arguments, subcommands.

Behaviour changes

  • The "CommandsAPI is up to date" line is no longer logged at startup.
  • Spigot: unregisterCommand now really removes the command (see the 5.4.0 fix).
  • platform-paper, which is new:
    • a command missing a required argument gets Brigadier's "incomplete command" error instead of the CommandsAPI usage message;
    • a String argument only accepts vanilla word characters; declare it Infinite to accept any text.

Tests

  • 233 tests, all green.
  • New tests include: no network call when a manager is created; a Component with a click and a hover arriving intact; a Brigadier integer argument refused by the parser; unregisterAll leaving another manager's commands, both on the core and on a real Spigot SimpleCommandMap.
  • Not covered: what a real Minecraft client shows (argument colours, a hidden command). This relies on the canUse unit tests and on the server console, which parses with the same tree.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn

- The CommandManager constructor no longer calls Updater.checkUpdates();
  -Dcommands.updater=false turns an explicit check off too, and versions
  are compared as versions so a newer or uncomparable build is never
  announced as outdated.
- CommandManager#unregisterAll() removes every command the manager
  registered, and only those.
- Requirement#name() fills %requirement% when errorMessage() is empty.
- Spigot: an unregistered command is removed from the known commands, not
  just marked; Spigot and Velocity no longer remove a label another plugin
  holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
A new adventure-addon module adds ComponentMessageFormatter: it receives
each message by its MessageKey with its values (arg, requirement, usage)
apart, and the component it builds is sent as a component, so click and
hover events survive. The Velocity manager exposes setComponentFormatter.

The core stays free of Adventure: it gains MessageKey, MessageDispatcher
and CommandManager#sendMessage(receiver, key, text, values), which falls
back on the unchanged text path when no dispatcher is set or it declines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
platform-paper registers commands through LifecycleEvents.COMMANDS:
typed arguments become Brigadier nodes, permission and requirements the
node's requires, and running a node goes through the usual invoker.
BrigadierCommandTree holds the translation, testable with Brigadier
alone; paper-test-plugin exercises it on a real server.

Tested on Paper 1.21.4 and 26.3: a label registered after startup
answers after the next /minecraft:reload, an unregistered command is
hidden by its requires and answers as unknown. The README documents it.

Also fixes ComponentMessageFormatter.miniMessage leaving the tags of
absent values as typed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
- Annotations: @default("value") makes an argument optional, the value
  being converted by the parameter type's converter when it is left out;
  an invalid default on a primitive is refused at registration.
- CommandManager#describe() returns a public, read-only tree of command
  and argument descriptions, for generating command documentation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
@Traqueur-dev Traqueur-dev changed the title feat(core): 5.4.0, opt-in update check, unregisterAll, requirement names 5.4.0 → 5.7.0: Paper on Brigadier, Component messages, unregisterAll, @Default, describe() Oct 21, 2026
@Traqueur-dev
Traqueur-dev merged commit 5b6e666 into master Oct 21, 2026
1 check passed
@Traqueur-dev
Traqueur-dev deleted the ccr-55933618-ihvtq0 branch October 21, 2026 14:21
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants